package main

import (
	"fmt"
	"time"
)

// 时间

func main()  {

	now :=time.Now()
	fmt.Println(now.Year())
	// 时间戳
	fmt.Println(now.UnixNano())

	//timer :=time.Tick(time.Second)
	//for t:= range timer{
	//	fmt.Println(t) // 1秒钟执行一次
	//}

	fmt.Println(now.Format("2006-01-02 03:04:05")) // 2020-04-26 09:47:14
	fmt.Println(now.Format("2006-01-02 15:04:05")) // 2020-04-26 21:52:05
	fmt.Println(now.Format("2006-01-02 03:04:05")) // 2020-04-26 21:52:05

	n :=5
	time.Sleep(time.Duration(n) * time.Second)
	fmt.Println("5秒过去了")
}
